<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>

<head>
    <title>健康监测</title>
</head>

<body>

<div id="wrapper">
    <div class="gray-bg">
        <div class="row m-t-sm">
            <div class="col-lg-12">
                <ol class="breadcrumb f-fl">
                    <li>
                        <i class="fa fa-location-arrow"></i>  <a>健康监测</a>
                    </li>
                    <li class="active">
                        <strong>健康监测</strong>
                    </li>
                </ol>
            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox">
                        <div class="ibox-content">
                            <div class="search-area">
                                <form role="form" class="form-inline" id="queryform">
                                    <c:if test="${residentId}">
                                        <input type="hidden"  name="residentId"
                                               class="form-control form-filter" value="${residentId}">
                                    </c:if>
                                    <div class="form-group">
                                        <div class="input-group date" datepicker>
                                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span><input type="text" id="startdate" name="startdate" placeholder="测量开始日期" value="" class="form-control form-filter" >
                                        </div>
                                    </div>
                                    -
                                    <div class="form-group">
                                        <div class="input-group date" datepicker>
                                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span><input type="text" id="enddate" name="enddate" placeholder="测量结束日期" value="" class="form-control form-filter" >
                                        </div>
                                    </div>
                                    <label for="title">
                                        <select name="dvtype"  class="form-control form-filter" form="queryform" style="width:100%">
                                            <option value="">监测类型</option>
                                            <option value="1">血压</option>
                                            <option value="2">身高</option>
                                            <option value="3">体重</option>
                                            <option value="4">记步</option>
                                        </select></label>
                                    <label for="title">
                                        <input type="input" placeholder="所属用户" name="title"
                                               id="title"
                                               class="form-control form-filter"></label>
                                    <button class="btn btn-primary" type="button" onclick="submitFilter()"> 查询</button>
                                    <button class="btn btn-primary" datatable-clear type="button"> 清除</button>
                                </form>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover dataTables" id="data-table"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>


<!-- Page-Level Scripts -->
<script>
    $(document).ready(function () {
        var setting = {
            "ajax": {
                "url": "${ctx}/admin/semRecord/list",
                "type": "POST"
            },
            "columns": [
                {"title": "所属用户", "data": "name", "width": "10%", "orderable": true},
                {"title": "测量时间", "data": "meterdate", "width": "10%", "orderable": true},
                {"title": "设备类型", "data": "lx", "width": "10%", "orderable": true},
                {"title": "数据来源", "data": "dvsource", "width": "20%", "orderable": true},
                {"title": "测量结果", "data": "result", "width": "20%", "orderable": true},
                {"title": "操作", "data": null, "width": "10%", "orderable": false},
            ],
            "columnDefs": [
                {
                    "targets": 5,
                    "render": function (data, type, row, meta) {
                        var result =
                                "<a class='btn btn-xs default btn-editable' onclick='update("+data.dataId+","+data.dvtype+")' href='javascript:void(0)'><i class='fa fa-pencil-square-o'></i> 查看 </a>";
                        return result;
                    }
                },
            ],
            "order": [
                [1, "desc"]
            ]
        };
        /* Init DataTables */
        $('#data-table').DataTable(ehconfig.get_datatable_config(setting));
        submitFilter = function () {
            $('#data-table').DataTable().draw();
        }
    });

    var update =function(id,dvtype){
        var lx;
        switch (dvtype){
            case 1:
                lx = '血压'
                break;
            case 2:
                lx = '身高'
                break;
            case 3:
                lx = '体重'
                break;
            case 4:
                lx = '记步'
                break;
            default :
                    lx = "指标"
                break;
        }
        parent.layer.open({
            type: 2,
            title: '检测详情-'+ lx ,
            shadeClose: true,
            shade: 0.8,
            area: ['770px', '450px'],
            content: '${ctx}/admin/semRecord/sem/list?id='+id+'&dvtype='+dvtype
        });
    }

</script>

</body>

</html>
